using System;
using System.Collections.Generic;
using System.Text;
using Krile.Kernel.Data;

namespace Krile.Kernel.Bridges
{
    public interface IStatusManager
    {

        #region Status Control

        /// <summary>
        /// Regist new status
        /// </summary>
        /// <param name="status">add statuses array</param>
        void RegistStatus(IEnumerable<Status> statuses);

        /// <summary>
        /// Regist new status
        /// </summary>
        /// <param name="status">add statuses array</param>
        /// <param name="notNewest">if this flag is true, it will be appear as new status.</param>
        void RegistStatus(IEnumerable<Status> statuses, bool isNew);

        /// <summary>
        /// Remove status
        /// </summary>
        /// <param name="rmstts">remove statuses' uid array</param>
        void RemoveStatus(ulong[] rmuids);

        /// <summary>
        /// Update status search
        /// </summary>
        /// <param name="statuses">statuses</param>
        void UpdateStatus(ulong[] uids);

        /// <summary>
        /// Uid check already exists
        /// </summary>
        /// <param name="uid">check uid</param>
        /// <returns>already existed:true</returns>
        bool IdExists(ulong uid);

        /// <summary>
        /// Lookup status by uid
        /// </summary>
        /// <param name="uid">statuses' uid</param>
        Status GetStatus(ulong uid);

        #endregion

        #region Search And Screening Control

        /// <summary>
        /// Get status array which matched search data.
        /// </summary>
        /// <param name="sdb">search data</param>
        /// <returns>status array</returns>
        Krile.Kernel.Data.Status[] ExtractStatuses(Krile.Kernel.Data.SearchDataBase sdb);

        #endregion

        #region Search Data Manager

        /// <summary>
        /// Regist new search data
        /// </summary>
        /// <param name="sd">search data object</param>
        void RegistNewSearchData(Type searchDataType);

        /// <summary>
        /// Lookup search data by search data id
        /// </summary>
        /// <param name="sdid">search data id</param>
        /// <returns>Lookup succeded:returns instance,else returns null</returns>
        SearchData LookupSearchData(string sdid);

        #endregion

        /// <summary>
        /// On regist new statuses in status server
        /// </summary>
        event Krile.Kernel.Data.Common.StatusRegistedCallback OnStatusRegistered;

        /// <summary>
        /// On remove statuses in status server
        /// </summary>
        event Krile.Kernel.Data.Common.StatusRegistedCallback OnStatusRemoved;

        /// <summary>
        /// Issue Next universal identification number
        /// </summary>
        /// <returns>uid</returns>
        ulong GetNextUID();
    }
}
